package com.czy.workflow.demo.dao;

import com.czy.workflow.demo.model.BizDoc1;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface BizDoc1Repository extends JpaRepository<BizDoc1, Long> {

    @Query(value = "select d from biz_doc1 d, flow_runtime_node rn, flow_node n "
            + "where d.doc_id = rn.doc_id and rn.node_id = n.id and n.element_id = ?1", nativeQuery = true)
    List<BizDoc1> queryByElement(String elementId);


    @Query(value = "select d from biz_doc1 d, flow_runtime_node rn, flow_node n "
            + "where d.doc_id = rn.doc_id and rn.node_id = n.id and n.element_id in (?1)", nativeQuery = true)
    List<BizDoc1> queryByElements(List<String> elementIds);

}
